package com.neusoft.neuiotms.dcvm.task;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import com.neusoft.neuiotms.dcvm.task.cmdbSyn.service.CmdbRackSynService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
@DisallowConcurrentExecution
public class CmdbRackSynTask extends QuartzJobBean {
    @Autowired
    private CmdbRackSynService cmdbRackSynService;

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        final long startAt = System.currentTimeMillis();
        CmdbRackSynTask.log.info("开始同步机柜接口数据 start at: {}", startAt);
        this.cmdbRackSynService.doUpdate();
        CmdbRackSynTask.log.info("开始同步机柜接口数据 finish, elapsed {} s", (System.currentTimeMillis() - startAt) % 1000);
    }

}
